/*

Seth Hill	
Proposal title: Citizen Beliefs About Media Bias in the United States


HYPOTHESES

Stated-Hyp1: People percieve the media to be biased (direction of bias unspecified): 
They think they learn more(less) from the same headline if the media source is provided

	NOTE: The experiment has four news sources: CNN, FOX, NYT, USA Today.
	The hypotheses don't pertain to the news source or partisan identity.
	
	Test-Hyp1: There will be a difference in level of belief in a statement if 
	a news source is shown alongwith the statement versus if the news source is 
	suppressed.

********************************************************************************
NOTES:

- Each respondent saw 4 rounds. Round 1 has 3 questions and rounds 2-4 had 2 
questions each. 
- This analysis requires re-shaping the file such that reach question is a row. 
Then use statement fixed effects to see if the effect of statement varies 
with and without source. 
- Note that individual FE are not required because it is a 
between-subject design (page 8 of proposal).

*/

clear all
use "PN8041_TESS010_Hill.dta", clear
********************************************************************************


* INDICATORS OF EXPERIMENTAL MANIPULATION

* What was the news source provided

	/* 
	FROM PAPER:

	1	China devalues yuan in shocking move	CNN
	1	China's currency falls for second day after devaluation jolts global markets	Fox News
	1	Why Did China Devalue Its Currency? Two Big Reasons	New York Times
	1	Global stocks sink as China's yuan falls for second day	USA Today
	2	US economy grows incredible 5% in third quarter	CNN
	2	Oil Prices Up on Better-than-Expected GDP	Fox News
	2	Economic Vital Signs in 3rd Quarter Were Strongest in a Decade	New York Times
	2	U.S. economic growth surges past estimates in Q3	USA Today
	3	America's economy is stronger than weak jobs report	CNN
	3	Dollar Plunges After Dismal Jobs Report	Fox News
	3	Sharp Fall in U.S. Hiring Saps Chance of Fed Rate Increase in June	New York Times
	3	These stocks get hit hard by ugly job news	USA Today
	4	Trump's budget: Spends on defense slashes safety nets	CNN
	4	Trump budget sees big cuts, big deficits	Fox News
	4	Trump Budget Cuts Programs for Poor While Sparing Many Older People	New York Times
	4	Trump budget hard on 'forgotten' rural American supporters	USA Today

	*/


	* fact shown in each manipulation (total 4 rounds)
		
		* NOTE: for question 42, variable name needs correction to add to loop
		rename INS_Q41 Q41_HINS1
		lab def fact 1 "1 China currency" 2 "2 Economy good" 3 "3 Economy bad" 4 "4 Budget cut"

		foreach var in 12 13 22 23 32 33 41 43 {
		gen fact`var'=.
		replace fact`var' = 1 if Q`var'_HINS1==1 // China devalues yuan in shocking move
		replace fact`var' = 1 if Q`var'_HINS1==2 // China's currency falls for second day a
		replace fact`var' = 1 if Q`var'_HINS1==3 // Why Did China Devalue Its Currency? Two
		replace fact`var' = 1 if Q`var'_HINS1==4 // Global stocks sink as China's yuan fall
		replace fact`var' = 2 if Q`var'_HINS1==5 // US economy grows incredible 5% in third
		replace fact`var' = 2 if Q`var'_HINS1==6 // Oil Prices Up on Better-than-Expected 
		replace fact`var' = 2 if Q`var'_HINS1==7 // Economic Vital Signs in 3rd Quarter Wer
		replace fact`var' = 2 if Q`var'_HINS1==8 // U.S. economic growth surges past estima
		replace fact`var' = 3 if Q`var'_HINS1==9 // America's economy is stronger than weak
		replace fact`var' = 3 if Q`var'_HINS1==10 // Dollar Plunges After Dismal Jobs Report
		replace fact`var' = 3 if Q`var'_HINS1==11 // Sharp Fall in U.S. Hiring Saps Chance o
		replace fact`var' = 3 if Q`var'_HINS1==12 // These stocks get hit hard by ugly job n
		replace fact`var' = 4 if Q`var'_HINS1==13 // Trump's budget: Spends on defense slash
		replace fact`var' = 4 if Q`var'_HINS1==14 // Trump budget sees big cuts, big deficit
		replace fact`var' = 4 if Q`var'_HINS1==15 // Trump Budget Cuts Programs for Poor Whi
		replace fact`var' = 4 if Q`var'_HINS1==16 // Trump budget hard on 'forgotten' rural

		lab val fact`var' fact
		}

		foreach var in 12 13 22 23 32 33 41 43 {
		tab fact`var'
		}

	* media source shown in each manipulation (even if source is suppressed, the statement pertains to that source)	
		
		lab def source 1 "1 CNN" 2 "2 FOX" 3 "3 NYT" 4 "4 USA Today"

		foreach var in 12 13 22 23 32 33 41 43 {
		gen source`var'=.
		replace source`var' = 1 if Q`var'_HINS1==1 // China devalues yuan in shocking move
		replace source`var' = 2 if Q`var'_HINS1==2 // China's currency falls for second day a
		replace source`var' = 3 if Q`var'_HINS1==3 // Why Did China Devalue Its Currency? Two
		replace source`var' = 4 if Q`var'_HINS1==4 // Global stocks sink as China's yuan fall
		replace source`var' = 1 if Q`var'_HINS1==5 // US economy grows incredible 5% in third
		replace source`var' = 2 if Q`var'_HINS1==6 // Oil Prices Up on Better-than-Expected 
		replace source`var' = 3 if Q`var'_HINS1==7 // Economic Vital Signs in 3rd Quarter Wer
		replace source`var' = 4 if Q`var'_HINS1==8 // U.S. economic growth surges past estima
		replace source`var' = 1 if Q`var'_HINS1==9 // America's economy is stronger than weak
		replace source`var' = 2 if Q`var'_HINS1==10 // Dollar Plunges After Dismal Jobs Report
		replace source`var' = 3 if Q`var'_HINS1==11 // Sharp Fall in U.S. Hiring Saps Chance o
		replace source`var' = 4 if Q`var'_HINS1==12 // These stocks get hit hard by ugly job n
		replace source`var' = 1 if Q`var'_HINS1==13 // Trump's budget: Spends on defense slash
		replace source`var' = 2 if Q`var'_HINS1==14 // Trump budget sees big cuts, big deficit
		replace source`var' = 3 if Q`var'_HINS1==15 // Trump Budget Cuts Programs for Poor Whi
		replace source`var' = 4 if Q`var'_HINS1==16 // Trump budget hard on 'forgotten' rural

		lab val source`var' source
		}

		foreach var in 12 13 22 23 32 33 41 43 {
		tab source`var'
		}
	
* CONSTRUCT OUTCOME MEASURE

* learning from the headline: how likely do you believe the statement is true
	
	*replacing missing values to .
	foreach var in 11 12 13 22 23 32 33 41 43 {
	replace Q`var' =. if Q`var'==998
	rename Q`var' believe`var'
	}
	
	
* RESHAPE

// reshape file to long (so that we can pool the data for each respondent)
	reshape long believe source fact, i(CaseId) j(question)
	
	
* Dichotomous indicator of whether source was shown
	
	* was source shown?
		// note: source only shown in rounds 2-4
	gen source_yes = .
	replace source_yes=0 if question ==11|question==12|question==13
	replace source_yes=1 if question==22|question==23 
	replace source_yes=1 if question==32|question==33 
	replace source_yes=1 if question==41|question==43 
	tab source_yes, mis
	
* Create indicator of statement (4x4)
	gen statement=.
	replace statement=1 if fact==1 & source==1
	replace statement=2 if fact==2 & source==1
	replace statement=3 if fact==3 & source==1	
	replace statement=4 if fact==4 & source==1	
	replace statement=5 if fact==1 & source==2	
	replace statement=6 if fact==2 & source==2	
	replace statement=7 if fact==3 & source==2	
	replace statement=8 if fact==4 & source==2	
	replace statement=9 if fact==1 & source==3
	replace statement=10 if fact==2 & source==3
	replace statement=11 if fact==3 & source==3	
	replace statement=12 if fact==4 & source==3	
	replace statement=13 if fact==1 & source==4	
	replace statement=14 if fact==2 & source==4
	replace statement=15 if fact==3 & source==4
	replace statement=16 if fact==4 & source==4
	tab statement
	
********************************************************************************
	
*ANALYSIS
	
*Test-Hyp1: There will be a difference in level of belief in a statement if a news source is shown alongwith the statement versus if the news source is suppressed.

	// Note: used statement fixed effects; clustered by respondent id
	reg believe i.source_yes i.statement, vce(cluster CaseId)
	tess 1.source_yes, init(Hill878)
	// do not reject. 0.000

// NOTE: the p-value of the main effect size is the same with or without statement fixed effects:	
	reg believe i.source_yes, vce(cluster CaseId)
